package com.demo.shiro.service;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.shiro.session.Session;

import java.util.Date;
public class ShiroService {
    @RequiresRoles({"admin"})//这个注解会与spring的事务注解@Transactional冲突，造成类型转换错误
    public void testAnnotation(){
        Session session = SecurityUtils.getSubject().getSession();
        Object key = session.getAttribute("sessionKey");
        System.out.println("sessionVal:"+key);
        System.out.println("*******************************"+new Date());
    }
}
